package com.hw.backapi.service.base;


import cn.hutool.core.date.DateTime;
import com.hw.backapi.context.UserAuthContext;
import com.hw.common.enums.DeletedStatusEnum;
import com.hw.model.dto.user.LoginDTO;
import com.hw.model.entity.BaseEntity;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @Author lipeng
 * @Date 2022/8/19 10:55
 */
public class EntityUtil {
    /**
     * 初始化baseEntity
     * @param t
     * @param <T>
     * @return
     */
    public static <T extends BaseEntity> T getInitBaseEntity(T t) {
        t.setCreatedAt(new Date());
        t.setUpdatedAt(new Date());
        return t;
    }

    /**
     * 更新需要修改的字段
     * @param t
     * @param <T>
     * @return
     */
    public static <T extends  BaseEntity> T updateBaseEntity(T t){
        t.setUpdatedAt(new Date());
        return t;
    }

}
